<?php
Class IndexAction extends Action{
    
    //A组签到
    Public function index(){
        $this->peo=M('peo')->select();
        $this->display('index');
    }

    //B组签到
    Public function B(){
        $this->peo=M('peo')->where(array('dep'=>2))->select();
        $this->display('index');
    }
    //统计未到
    Public function noreach(){
        $this->sum=M('peo')->count();
        $this->reach=M('peo')->where(array('reach'=>1))->count();
        $this->notreach=M('peo')->where(array('reach'=>0))->count();
        $this->peo=M('peo')->where(array('reach'=>0))->select();
        $this->display('index');
    }
    //超级无敌搜索
    Public function soso(){
        $name=$_POST['name'];
        $this->peo=M('peo')->where(array('name'=>array('like','%'.$name.'%')))->select();
        $this->count=M('peo')->where(array('name'=>array('like','%'.$name.'%')))->count();
        $this->display('index');
    }
    //添加企业页面
    Public function addname(){
        $this->display();
    }
    //添加企业表单处理
    Public function addHandle(){
        $dep=$_POST['dep'];
        switch ($dep) {
            case 'A':
            $dep=1;
                break;
            case 'B':
            $dep='2';
                break;
            case 'a':
            $dep=1;
                break;
            case 'b':
            $dep=2;
                break;
        }
        $data=array(
            'name'=>$_POST['name'],
            'dep'=>$dep,
            'xuhao'=>$_POST['xuhao']
            );
        if(M('peo')->data($data)->add()){
            $this->success('添加成功',U(GROUP_NAME.'/Index/index'));
        }
    }
}

?>
